package org.pjsip.pjsua2.app;


import org.pjsip.iface.OnSipStatusChangedListenerImpl;
import org.pjsip.pjsua2.MySipPhoneEvent;

public class MyApplication extends BaseApplication {
    static {
        try {
            System.loadLibrary("pjsua2");
            System.out.println("Library loaded");
        } catch (UnsatisfiedLinkError e) {
            System.out.println("UnsatisfiedLinkError: " + e.getMessage());
            System.out.println("This could be safely ignored if you " +
                    "don't need video.");
        }
    }

    private static volatile MyApplication instance;

    public static MyApplication getInstance() {
        if (instance == null) {
            synchronized (MyApplication.class) {
                if (instance == null) {
                    instance = new MyApplication();
                }
            }
        }
        return instance;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        /**
         * SIP listener
         */
        MySipPhoneEvent.setOnSipStatusChangedListener(new OnSipStatusChangedListenerImpl());
    }
}
